
import datetime
from selenium import webdriver
from selenium.webdriver.firefox.service import  Service as FirefoxService
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.common.by import By
# from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Firefox(service=FirefoxService(GeckoDriverManager().install()))
driver.get("https://www.example.com")
driver.maximize_window()
text = driver.find_element(By.XPATH, "XPATH").text
print(text)
# btn = driver.find_element(By.XPATH,"XPATH")
# ActionChains(driver).click(btn).perform()
# driver.quit()
driver.switch_to.new_window('tab')
driver.get("https://www.example.com")
text = driver.find_element(By.XPATH, "XPATH").text
print(text)
driver.quit()

print(datetime.datetime.now().strftime('%Y年%m月%d日 %H时%M分%S秒'))